import { Column, CreateDateColumn, Entity, JoinTable, ManyToMany, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
import { Permission } from "./permission.entity";

@Entity()
export class LoginUser {
    @PrimaryGeneratedColumn()
    id: number

    @Column({
        length: 50,
        comment: '用户名'
    })
    username: string

    @Column({
        length: 50,
        comment: '密码'
    })
    password: string

    @CreateDateColumn({
        comment: '创建时间'
    })
    createTime: Date

    @UpdateDateColumn({
        comment: '更新时间'
    })
    updateTime: Date

    @ManyToMany(() => Permission)
    @JoinTable({
        name: 'user_permission_relation'
    })
    permissions: Permission[]
}
